import request from '@/router/axios';
import qs from 'qs';
import Apis from './apiUrl';
export default {
  getDatasourceAuth(){
    return request({
      url: Apis.datasourceAuth,
      method: 'get',
      data: {
      }
    })
  },
  query(params){
    return request({
      url: Apis.query,
      method: 'POST',
      data: qs.stringify(params),
      headers: {
        'content-type': 'application/x-www-form-urlencoded;charset=UTF-8'
      }
    })
  },
  presto(params){
    return request({
      url: Apis.presto,
      method: 'POST',
      data: qs.stringify(params),
      headers: {
        'content-type': 'application/x-www-form-urlencoded;charset=UTF-8'
      }
    })
  },
  prestoAsync(params){
    return request({
      url: Apis.prestoAsync,
      method: 'POST',
      data: qs.stringify(params),
      headers: {
        'content-type': 'application/x-www-form-urlencoded;charset=UTF-8'
      }
    })
  },
  queryStatus(params){
    return request({
      url: Apis.queryStatus,
      method: 'POST',
      data: qs.stringify(params),
      headers: {
        'content-type': 'application/x-www-form-urlencoded;charset=UTF-8'
      }
    })
  },
  historyStatus(params){
    return request({
      url: Apis.historyStatus,
      method: 'GET',
      params: params,
      headers: {
        'content-type': 'application/x-www-form-urlencoded;charset=UTF-8'
      }
    })
  },
  history(params){
    return request({
      url: Apis.history,
      method: 'GET',
      // data: qs.stringify(params),
      params: params,
      headers: {
        'content-type': 'application/x-www-form-urlencoded;charset=UTF-8'
      }
    })
  },
  killQuery (params) {
    return request({
      url: Apis.kill,
      method: 'POST',
      data: qs.stringify(params),
      headers: {
        'content-type': 'application/x-www-form-urlencoded;charset=UTF-8'
      }
    })
  },
  getLog(id) {
    return request({
      url: Apis.log + id,
      method: 'GET',
      params: {},
      // headers: {
      //   'content-type': 'application/x-www-form-urlencoded;charset=UTF-8'
      // }
    })
  }
}